/**********************************************************************
 * Project : WoWGuildRoster (http://www.codeplex.com/WowGuildRoster/)
 * Module  : DotNetWarcraft.WoWGuildRoster.UI.DNN.WGR_CharEntry_StatList
 **********************************************************************
 * 
 * 
 * 
 **********************************************************************
 * License : All code is subject to licensing terms per the Microsoft
 *   Permissive License (Ms-PL) v1.1. For full license information,
 *   refer to the packaged license.txt file.
 **********************************************************************
 * Revision History:
 * -----------------
 * 2007-10-12 -- Cliff Simpkins: Initial Version
 **********************************************************************
 */
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using DotNetNuke;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Localization;
using DotNetNuke.Services.Exceptions;

using WGR_Business = DotNetWarcraft.WoWGuildRoster.Business;

namespace DotNetWarcraft.WoWGuildRoster.UI.DNN {
  public partial class WGR_CharEntry_StatList : PortalModuleBase {
    #region Public Properties
    public int ParentModuleID {
      get {
        try {
          return int.Parse(lblParentModuleID.Text);
        } catch {
          return -1;
        }
      }
      set {
        lblParentModuleID.Text = value.ToString();
      }
    }
    public String StatType {
      get {
        return lblStatType.Text;
      }
      set {
        lblStatType.Text = value;

        tblBaseStats.Visible = false;
        tblMelee.Visible = false;
        tblSpell.Visible = false;
        tblRanged.Visible = false;
        tblDefense.Visible = false;

        switch (value) {
          case WGR_Business.WGRDnnConstants.ASCX_CHARENTRY_STATTYPE_BASE:
            tblBaseStats.Visible = true;
            break;
          case WGR_Business.WGRDnnConstants.ASCX_CHARENTRY_STATTYPE_MELEE:
            tblMelee.Visible = true;
            break;
          case WGR_Business.WGRDnnConstants.ASCX_CHARENTRY_STATTYPE_SPELL:
            tblSpell.Visible = true;
            break;
          case WGR_Business.WGRDnnConstants.ASCX_CHARENTRY_STATTYPE_RANGED:
            tblRanged.Visible = true;
            break;
          case WGR_Business.WGRDnnConstants.ASCX_CHARENTRY_STATTYPE_DEFENSE:
            tblDefense.Visible = true;
            break;
          default:
            break;
        }

      }
    }
    #endregion
    #region Public Methods
    public List<WGR_Business.GuildEntryStat> StatList {
      set {
        foreach (WGR_Business.GuildEntryStat _stat in value) {
          switch (_stat.Stat_Type_Enum) {
            case WGR_Business.WarcraftStatTypes.Ability:
              switch (_stat.Stat_Entry) {
                case "Agility":
                  this.lblVal_bAgi.Text = _stat.Stat_Value_int.ToString();
                  break;
                case "Armor":
                  this.lblVal_bArmor.Text = _stat.Stat_Value_int.ToString();
                  break;
                case "Intellect":
                  this.lblVal_bInt.Text = _stat.Stat_Value_int.ToString();
                  break;
                case "Spirit":
                  this.lblVal_bSpi.Text = _stat.Stat_Value_int.ToString();
                  break;
                case "Stamina":
                  this.lblVal_bSta.Text = _stat.Stat_Value_int.ToString();
                  break;
                case "Strength":
                  this.lblVal_bStr.Text = _stat.Stat_Value_int.ToString();
                  break;
                default:
                  break;
              }
              break;
            case WGR_Business.WarcraftStatTypes.MeleeSkill:
              switch (_stat.Stat_Group) {
                case "AttackPower":
                  if (_stat.Stat_Entry == "Base") {
                    this.lblVal_mPower.Text = _stat.Stat_Value_int.ToString();
                  }
                  break;
                case "CritChance":
                  if (_stat.Stat_Entry == "Rating") {
                    this.lblVal_mCritCh.Text = _stat.Stat_Value_dec.ToString();
                  }
                  break;
                case "HitRating":
                  if (_stat.Stat_Entry == "Value") {
                    this.lblVal_mHR.Text = _stat.Stat_Value_int.ToString();
                  }
                  break;
                case "MainHand":
                  if (_stat.Stat_Entry == "Skill") {
                    this.lblVal_mWeapSk.Text = _stat.Stat_Value_int.ToString();
                  } else if (_stat.Stat_Entry == "Speed") {
                    this.lblVal_mSpd.Text = _stat.Stat_Value_dec.ToString();
                  } else if (_stat.Stat_Entry == "Damage") {
                    this.lblVal_mDmg.Text = _stat.Stat_Value_dec.ToString();
                  }
                  break;
                default:
                  break;
              }
              break;
            case WGR_Business.WarcraftStatTypes.RangedSkill:
              switch (_stat.Stat_Group) {
                case "AttackPower":
                  if (_stat.Stat_Entry == "Base") {
                    this.lblVal_rPower.Text = _stat.Stat_Value_int.ToString();
                  }
                  break;
                case "CritChance":
                  if (_stat.Stat_Entry == "Rating") {
                    this.lblVal_rCritCh.Text = _stat.Stat_Value_dec.ToString();
                  }
                  break;
                case "HitRating":
                  if (_stat.Stat_Entry == "Value") {
                    this.lblVal_rHR.Text = _stat.Stat_Value_int.ToString();
                  }
                  break;
                case "Weapon":
                  if (_stat.Stat_Entry == "Skill") {
                    this.lblVal_rWeapSk.Text = _stat.Stat_Value_int.ToString();
                  } else if (_stat.Stat_Entry == "Speed") {
                    this.lblVal_rSpd.Text = _stat.Stat_Value_dec.ToString();
                  } else if (_stat.Stat_Entry == "Damage") {
                    this.lblVal_mDmg.Text = _stat.Stat_Value_dec.ToString();
                  }
                  break;
              }
              break;
            case WGR_Business.WarcraftStatTypes.SpellSkill:
              switch (_stat.Stat_Group) {
                case "HealingBonus":
                  if (_stat.Stat_Entry == "HealingBonus") {
                    this.lblVal_sBnsHeal.Text = _stat.Stat_Value_int.ToString();
                  }
                  break;
                case "CritRating":
                  if (_stat.Stat_Entry == "CritRating") {
                    this.lblVal_sCritCh.Text = _stat.Stat_Value_int.ToString();
                  }
                  break;
                case "HitRating":
                  if (_stat.Stat_Entry == "Value") {
                    this.lblVal_sHR.Text = _stat.Stat_Value_int.ToString();
                  }
                  break;
                case "ManaRegen":
                  if (_stat.Stat_Entry == "WhileNotCasting") {
                    this.lblVal_sManaReg.Text = _stat.Stat_Value_dec.ToString();
                  }
                  break;
                case "SpellPenetration":
                  if (_stat.Stat_Entry == "SpellPenetration") {
                    this.lblVal_sPen.Text = _stat.Stat_Value_int.ToString();
                  }
                  break;
                default:
                  break;
              }
              break;
            case WGR_Business.WarcraftStatTypes.DefenseSkill:
              switch (_stat.Stat_Group) {
                case "Armor":
                  if (_stat.Stat_Entry == "Base") {
                    this.lblVal_dArmor.Text = _stat.Stat_Value_int.ToString();
                  }
                  break;
                case "Block":
                  if (_stat.Stat_Entry == "Percent") {
                    this.lblVal_dBlock.Text = _stat.Stat_Value_dec.ToString() + "%";
                  }
                  break;
                case "Defense":
                  if (_stat.Stat_Entry == "Value") {
                    this.lblVal_dDefense.Text = _stat.Stat_Value_dec.ToString();
                  }
                  break;
                case "Dodge":
                  if (_stat.Stat_Entry == "Percent") {
                    this.lblVal_dDodge.Text = _stat.Stat_Value_dec.ToString();
                  }
                  break;
                case "Parry":
                  if (_stat.Stat_Entry == "Rating") {
                    this.lblVal_dParry.Text = _stat.Stat_Value_dec.ToString();
                  }
                  break;
                case "Resilience":
                  if (_stat.Stat_Entry == "Rating") {
                    this.lblVal_dResil.Text = _stat.Stat_Value_dec.ToString();
                  }
                  break;
                default:
                  break;
              }
              break;
            default:
              break;
          }
        }
      }
    }
    #endregion
    #region Protected Methods

    #endregion

    protected void Page_Load(object sender, EventArgs e) {
      try {
        if (!Page.IsPostBack) {
        }
      } catch (Exception exc) {
        Exceptions.ProcessModuleLoadException(this, exc);
      }

    }
  }
}